<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .content{
            width: 100px;           
            height: 100px;
            display: none;
            border: 1px solid red;
        }
        .active{
            background-color: yellow;
        }
    </style>
</head>
<body>
    <div class="box">
        <button class="active">111</button>
        <button>222</button>
        <button>333</button>
        <div class="content" style="display:block;">111</div>
        <div class="content">222</div>
        <div class="content">333</div>
    </div>
    <script>
        var btn = document.getElementsByTagName('button');
        var div = document.getElementsByClassName("content");
        var len = btn.length;
        for(var i = 0; i < len; i ++){
           (function (n) {
            btn[n].onclick = function (){
                for(var j = 0;j < len;j ++){
                    btn[j].className = "";
                    div[j].style.display = "none";
                }
                this.className = "active";
                div[n].style.display = "block";
            }
            }(i));
        }
    </script>
</body>
</html>